home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbasicpg.zip
/
BADNAME.BAS
< prev
next >
Wrap
BASIC Source File
|
1989-08-31
|
664b
|
27 lines
' BADNAME.BAS
' This program separates first and last names and prints them.
' Can you find the two logic errors?
CLS
PRINT "Enter your first and last name in the following format: ";
PRINT "Lastname, Firstname"
PRINT
INPUT "Name: ", fullName$
commaLocation% = INSTR(1, fullName$, ",")
IF (commaLocation% < 0) THEN
lastName$ = LEFT$(fullName$, commaLocation% - 1)
firstName$ = RIGHT$(fullName$, LEN(fullName$) - commaLocation% - 1)
PRINT
PRINT "What a lovely name! It's so nice to meet you, ";
PRINT firstName$; " "; lastName$; "!"
ELSE
PRINT
PRINT "Name not in Lastname, Firstname format."
END IF